<template>
  <div id='tmpl'>
   <div v-for="item in list">
     <h4 v-text="item.title"></h4>
     <span >{{item.add_time | datefmt('YYYY-MM-DD')}} &nbsp;</span> <span>{{item.click}} 次浏览</span>
     <hr>
     <div v-html="item.content" class="content"></div>
   </div>
   <!-- 实现评论组件集成 -->
   <comment :id='id'></comment>
  </div>
</template>
<script>
import common from '../kits/common.js'
import comment from '../subcom/comment.vue'
export default {
  name: "component_name",
   components:{
      comment
    },
  data () {
    return {
      id:0,
      list:[]
    };
  },
  created(){
    this.id = this.$route.params.id
    this.getnewsinfo();
  },
  methods:{
    getnewsinfo(){
      this.$http.get(common.apidomain+'/api/getnew/'+this.id).then(function(res){
        if(res.body.status != 0){
          alert(res.body.message);
          return;
        }
        this.list = res.body.message
      })
    }
  }
}
</script>
<style lang="css" scoped>
#tmpl{
  padding: 5px;
}
#tmpl span,hr{
  font-size:15px;
  color: rgba(0, 0, 0, 0.5)
}
#tmpl h4{
  color: #0094ff;
  margin: 5px;
  
}
</style>